<?php
/**
 * author       : xuefeng
 * createTime   : 2017/5/7 下午8:47
 * description  : user_log Year.php
 */
namespace App\Admin\Extensions\Tools;

use Encore\Admin\Admin;
use Encore\Admin\Grid\Tools\AbstractTool;
use Illuminate\Support\Facades\Request;

class YearAndMonth extends AbstractTool
{
    protected function script()
    {
        $url = Request::fullUrlWithQuery(['yearAndMonth' => '_yearAndMonth_']);

        return <<<EOT

$('input:radio.user-gender').change(function () {

    var url = "$url".replace('_gender_', $(this).val());

    $.pjax({container:'#pjax-container', url: url });

});

EOT;
    }

    public function render()
    {
        Admin::script($this->script());

        $options = [
            'all'   => 'All',
            'm'     => 'Male',
            'f'     => 'Female',
        ];

        return view('admin.tools.gender', compact('options'));
    }
}